import l4cr.Reservation
import l4cr.Salle
import java.util.Date

class BootStrap {

	def init = { servletContext ->
		if(!Salle.count){
			new Salle(numero:'1',batiment:'U1',capacite:20).save(failOnError:true)
			new Salle(numero:'2',batiment:'U1',capacite:30).save(failOnError:true)
		}
		if(!Reservation.count){
			new Reservation(cours:'IAWS',deb:new Date(2012,04,29,16,0),fin:new Date(2012,04,29,18,0)).save(failOnError:true)
			Salle.findById(1).addToReservations(Reservation.findByCours('IAWS'))
		}
	}
	def destroy = {
	}
}
